<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--
 -  
 -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 -  project.
 -  
 -  Copyright (C) 1998-2024 OpenLink Software
 -  
 -  This project is free software; you can redistribute it and/or modify it
 -  under the terms of the GNU General Public License as published by the
 -  Free Software Foundation; only version 2 of the License, dated June 1991.
 -  
 -  This program is distributed in the hope that it will be useful, but
 -  WITHOUT ANY WARRANTY; without even the implied warranty of
 -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 -  General Public License for more details.
 -  
 -  You should have received a copy of the GNU General Public License along
 -  with this program; if not, write to the Free Software Foundation, Inc.,
 -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 -  
 -  
-->
<html>
<head>
  <title>Mozilla Provinces Search</title>
  <HEAD><link rel="stylesheet" type="text/css" href="../demo.css" /></HEAD>
  <script type="text/javascript" src="../soap.js"></script>
  <script type="text/javascript" id="soap_script">
 function init_countries()
   {
     var req = null;
     try {
       req = new ActiveXObject("Msxml2.XMLHTTP");
     } catch (e) { }
		
     if (req == null) {
       try {
       	req = new ActiveXObject("Microsoft.XMLHTTP");
		   } catch (e) { }
		 } // if
		
		 // Gecko / Mozilla / Firefox
		 if (req == null)
		   req = new XMLHttpRequest();
     if (!req) {
	 			alert ('XMLHttpRequest is not supported');
	 			return;
     }
     req.onreadystatechange =
	 function()
	  {
	     if (req.readyState == 4 && req.status == 200)
	       {
		 var respXML =  req.responseXML;
		 var elms = respXML.getElementsByTagName("CallReturn");
		 fill_inner (elms, 'divMenuCountry');
	       }
	     else if (req.readyState == 4 && req.status != 200)
	       {
		 document.getElementById('divMenuCountry').innerHTML = 'Error occured';
		 soap_error_alert (req);
	       }
	  }

     req.open('POST', '/SOAP_SO_S_11/');
     req.setRequestHeader('Content-Type', 'text/xml; charset=UTF-8');
     req.setRequestHeader('SOAPAction', '"http://openlinksw.com/virtuoso/soap/schema#countries"');
     req.send
	 (
	 '<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"' +
	 ' env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" ' +
	 ' xmlns:xs="http://www.w3.org/1999/XMLSchema" ' +
	 ' xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">' +
	 ' <env:Body>' +
	 '    <a0:countries xmlns:a0="http://openlinksw.com/virtuoso/soap/schema">'+
	 '       <ch xsi:type="xs:int">1</ch>'+
	 '    </a0:countries>'+
	 ' </env:Body>'+
	 '</env:Envelope>'
	 );
   }

  function get_provinces()
  {
    var country = document.forms[0].country.value;
     var req = null;
     try {
       req = new ActiveXObject("Msxml2.XMLHTTP");
     } catch (e) { }
		
     if (req == null) {
       try {
       	req = new ActiveXObject("Microsoft.XMLHTTP");
		   } catch (e) { }
		 } // if
		
		 // Gecko / Mozilla / Firefox
		 if (req == null)
		   req = new XMLHttpRequest();
     if (!req) {
	 			alert ('XMLHttpRequest is not supported');
	 			return;
     }
     req.onreadystatechange =
	 function()
	  {
	     if (req.readyState == 4 && req.status == 200)
	       {
		 var respXML =  req.responseXML;
		 var elms = respXML.getElementsByTagName("CallReturn");
		 fill_inner (elms, 'provinces');
	       }
	     else if (req.readyState == 4 && req.status != 200)
	       {
		 soap_error_alert (req);
	       }
	  }

     req.open('POST', '/SOAP_SO_S_11/');
     req.setRequestHeader('Content-Type', 'text/xml; charset=UTF-8');
     req.setRequestHeader('SOAPAction', '"http://openlinksw.com/virtuoso/soap/schema#get_provinces_for_country"');
     req.send
	 (
	 '<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"' +
	 ' env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" ' +
	 ' xmlns:xs="http://www.w3.org/1999/XMLSchema" ' +
	 ' xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">' +
	 ' <env:Body>' +
	 '    <a0:get_provinces_for_country xmlns:a0="http://openlinksw.com/virtuoso/soap/schema">'+
	 '       <country xsi:type="xs:string">'+country+'</country>'+
	 '       <use_stored xsi:type="xs:string">on</use_stored>'+
	 '    </a0:get_provinces_for_country>'+
	 ' </env:Body>'+
	 '</env:Envelope>'
	 );
  }
  </script>
</head>

<body onload="init_countries();">
    <h3>Global Provinces lookup</h3>
    <form action="#" onsubmit="return false;" id="form_id">
	<div id="divMenuCountry"></div>
	<div><input type="button" value="Get data" id="button_id" onclick="get_provinces();" ></div>
    </form>
    <div id="provinces"></div>
</body>
</html>

